#include "mdi.h"

MdiWindow::MdiWindow()
{
	mdi = new QMdiArea();
	text1 = new QTextEdit();
	text2 = new QTextEdit();
	mdi->addSubWindow(text1);
	mdi->addSubWindow(text2);
	mdi->cascadeSubWindows();

	setCentralWidget(mdi);
	connect(mdi, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(mdiSlot(QMdiSubWindow *)));
}

void MdiWindow::mdiSlot(QMdiSubWindow *window)
{
	if(window!=0)
	{
		text1->clear();
		text2->clear();

		QTextEdit *temp = (QTextEdit*)(window->widget());
		temp->setText(tr("我获取列焦点"));
	}
}
